Memory management unit

ABSTRACT

A system and method for managing memory is disclosed. The system includes a computer memory array and a memory management unit accessible to the memory array. The memory management unit includes a plurality of parallel comparators. The comparators receive a virtual memory address and perform a comparison of the virtual memory address to a plurality of predetermined addresses. The memory management unit also includes logic responsive to outputs of each of the comparators to determine a physical memory address of an element within the memory array.

FIELD OF THE DISCLOSURE

The present disclosure is related to management of memory devices.

BACKGROUND

Many computer memory systems employ virtual addresses. Generally, virtual addresses are addresses of virtual memory locations. These virtual addresses may not be referenced by actual hardware, but can be used by computer programs. A virtual address may be different than the physical address that is indicative of a physical memory location in a computer memory. For example, a computer program or operating system may use virtual addressing to implement a particular memory organization scheme. The use of virtual addresses may allow the memory scheme to be implemented more efficiently. In addition, the use of virtual addressing allows a computer program or operating system to be used with different types and brands of physical memory, because the program or operating system is not tailored to the particular physical addresses associated with any particular memory type or brand.

However, in order for the program or operating system to interact with the physical memory, each virtual address may be translated to a physical memory address. This can be done with a memory management unit (MMU). An MMU performs a translation function to translate a virtual address into a physical address. To perform the address translation function, the memory management unit may use a table showing the relation between the virtual and physical addresses. Such a table can be stored in the computer memory. In other systems, the address translation function may be performed using one or more arithmetic operations. However, each of these translation approaches may require be undesirably complex, and may consume excess time or power. Accordingly, there is a need for an improved memory management system and method.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of a particular illustrative embodiment of a system including a memory management unit;

FIG. 2 is a block diagram of a particular illustrative embodiment of the memory management unit illustrated in FIG. 1;

FIG. 3 is a block diagram of another particular embodiment of the memory management unit illustrated in FIG. 1; and

FIG. 4 is a flow diagram of a method of translating a virtual address to a physical address.

DESCRIPTION OF THE DRAWINGS

A system and method for managing memory is disclosed. The system includes a computer memory array and a memory management unit accessible to the computer memory array. The memory management unit includes a plurality of parallel comparators. The comparators receive a virtual memory address and perform a comparison of the virtual memory address to a plurality of predetermined addresses. The memory management unit also includes logic responsive to outputs of each of the comparators to determine a physical memory address of an element within the computer memory array.

The method includes receiving a virtual address from a computer device at a memory management unit coupled to the memory device and concurrently comparing at least a portion of the virtual address to different comparators. Each of the comparators is associated with a physical address of the memory device. The method further includes determining a physical address to access the memory device after performing the concurrent comparison. In addition, at least two of the different comparators are associated with a common physical address.

Referring to FIG. 1, block diagram of a particular embodiment of a system 100 including a memory management unit (MMU) 108 is illustrated. The system 100 includes a central processing unit (CPU) 102 and a direct memory access (DMA) device 104. The system 100 also includes a memory bus 106 and a memory array 110. The MMU 108 is responsive to the CPU 102 and the DMA device 104 via the memory bus 106. The MMU 108 is accessible to the memory array 110.

During operation, the CPU 102 and the DMA device 104 may send memory requests to the memory array 110 via the MMU 108. The CPU 102 may be a microprocessor, microcontroller, or other processor or controller. In addition, the CPU 102 may be incorporated in a computer device, a portable device such as a cell phone or portable music player, a consumer electronic device such as a television, DVD player or radio tuner, or other appropriate device. The CPU 102 may be run software programs to implement the desired functions of the system 100. For example, in the case of a portable music player, the CPU 102 may run software programs to store, organize, and play music files. The software programs run by the CPU 102 may also include an operating system or firmware to handle normal system functions, such as organization and maintenance of the memory array 110. The software programs may be stored in the memory array 110 or in another memory device.

In the course of running the software programs, the CPU 102 may access the memory array 110. For example, the CPU 102 may perform a read operation or a write operation on the memory array 110. In the case of a read operation, the CPU 102 may provide a virtual address to the memory management unit 108. The virtual address may be an address provided by a software program running on the CPU 102.

In addition, in some systems it may be desirable for the memory array 110 to be accessible to peripheral modules, such as printers, audio and video hardware, user interfaces, and the like. Access to memory array 110 by the peripheral modules can be managed by the CPU 102, but this may consume undesirable overhead and use of CPU time. Accordingly, the DMA device 104 can manage access to the memory array 110 by the peripheral modules, thereby saving CPU 102 overhead and time. The DMA device 104 may receive memory requests, such as read or write operations from various peripheral modules. The DMA device 104 may organize and prioritize these memory requests by placing the requests in a request queue. The DMA device 104 may send successive requests from the queue to the memory array 110 via the MMU 108. The DMA device 104 may also receive the response to each request from the memory array 110, organize and prioritize the responses in a response queue, and send successive responses from the response queue to the appropriate requesting peripheral module.

In addition, in a particular embodiment, the memory management unit 108 and the memory array 110 may be located on the same integrated circuit as the CPU 102. Alternatively, the CPU 102 may be coupled to additional memory devices external to the integrated circuit. Accordingly, the memory MMU 108 and the memory array 110 may respond more rapidly to memory requests from the CPU 102 relative to the external memory devices. Therefore, the CPU 102 may store information in the memory array 110 associated with low-latency memory requests. For example, the CPU 102 may store information associated with high-speed software programs, or high priority portions of a particular software program. Alternatively, the CPU 102 may store information in the memory array 110 according to a particular memory management scheme. For example, in the case of a portable music player, some system functions, such as a music playback function, may be used more often than others. The more frequently used functions may be stored in the memory array 110, improving the overall system efficiency.

Further, the virtual memory address space, or the range of virtual addresses that are addressable by the CPU 102 or the DMA device 104, may be larger than the range of physical addresses associated with the memory array 110. For example, a software program running on the CPU 102 may employ a virtual addressing scheme that includes a range of possible virtual address that is larger than the number of physical addresses associated with the memory array 110. The software program may do this for a variety of reasons. For example, a large range of virtual addresses may be useful for program flexibility; i.e. by using a large range of virtual addresses the software program may be used in conjunction with a wide variety of physical memory devices, including physical memory devices that are large enough to include a physical address for each virtual address. In contrast, if the range of virtual addresses were smaller than the range of physical addresses for a particular memory device, some of the memory device would be unused, possibly resulting in system inefficiency or wasted memory.

Accordingly, in some applications it may be desirable that the MMU 108 together with the memory array 110 is able to respond rapidly to memory requests and also process memory requests associated with a virtual address space that may be larger than the physical address space of the memory array 110. In conjunction with a memory request from the CPU 102 or the DMA DEVICE 104, the MMU 108 will typically receive a virtual memory address associated with the request via the memory bus 106. As explained with respect to FIG. 2, the MMU 108 compares the received virtual address to a plurality of predetermined virtual address. Each predetermined virtual address is associated with a physical address of the memory array 110. Based on the comparisons the MMU 108 determines a physical address associated with the received virtual address, and provides the physical address to the memory array 110. The memory array 110 responds to the memory request based on the physical address. For example, in the case of a read operation, the memory array 110 may send data stored at the physical address to the CPU 102 or the DMA DEVICE 104.

In a particular embodiment, the virtual address received by the MMU 108 is compared to several predetermined addresses in parallel. This allows the MMU 108 to rapidly process a memory request. In addition, in a particular embodiment, the MMU 108 is implemented using logic hardware, which can increase the speed of the MMU 108 as well as reduce the size and power required by the memory management unit.

In a particular embodiment, the MMU 108 is co-located with the memory array 110. In another particular embodiment, the MMU 108 is embedded in the memory array 110. Co-locating or embedding the MMU 108 with the memory array 110 may provide speed or other performance benefits for the MMU 108.

Referring to FIG. 2, a block diagram of a particular embodiment of the memory management unit 108 of FIG. 1 is illustrated. The MMU 108 includes an internal bus 202. The MMU 108 also includes a plurality of comparators, including a first comparator 208, a second comparator 212, a third comparator 216 and a fourth comparator 220. The MME 106 further includes a plurality of predetermined addresses, including a first predetermined address 206, a second predetermined address 210, a third predetermined address 214, and a fourth predetermined address 218. In addition, the MMU 108 includes logic 204.

As illustrated, the internal bus 202 is responsive to the memory bus 106. In addition, each of the plurality of comparators, such as the first comparator 208 and the second comparator 212, are responsive to the internal bus 202. Further, the logic 204 is responsive to an output of each of the comparators. Moreover, the memory array 110 is coupled to the logic 204 and the logic 204 is coupled to the memory bus 106 via a fault line 222. The memory array 110 is coupled to the memory bus 106 via a returned data bus 224.

During operation, the internal bus 202 may receive a virtual memory address via the memory bus 106. As explained with respect to FIG. 1, the virtual memory address may be provided by the CPU 102, the DMA device 104, or another device. The internal bus 202 may be of a similar size to the memory bus 106. For example, if the memory bus 106 is a 16 bit bus, the internal bus 202 may also be a 16 bit bus. In an alternative illustrative embodiment, the internal bus 202 may be smaller than the memory bus 106, and may be configured to receive only a portion of the virtual memory address. For example, the internal bus 202 may be configured so that it receives only a middle and lower portion of the virtual memory address, and truncates an upper portion of the address. This may be appropriate in certain virtual address schemes. For example, the virtual address scheme for the system 100 may be configured so that the upper portion of the virtual address refers to a particular memory device, memory page, or memory region. If the memory array 110 is comprised of a single memory device, page, or region, then any virtual address associated with the memory array 110 will include the same upper portion. Accordingly, the upper portion of the received virtual memory address may be truncated, and only a middle and lower portion of the virtual memory address may be provided to the internal bus 202.

The internal bus 202 provides the received virtual memory address to each of the plurality of comparators. Each of the plurality of comparators concurrently compares the received virtual address to a predetermined virtual address. For example, the first comparator 208 compares the received virtual address to the first predetermined address 206, while the second comparator 212 compares the received virtual address to the second predetermined address 210.

The predetermined address may be stored in a variety of ways. For example, the predetermined addresses may be stored in a ROM. In another particular embodiment, the predetermined addresses may be stored in a plurality of logic gates with fixed inputs. The outputs of the logic gates provide the predetermined address. The use of logic gates may provide for faster operation of the MMU 108.

The logic 204 is responsive to the outputs of the plurality of the comparators. Accordingly, based on the comparisons made by the comparators to the received virtual address, the logic 204 can select a physical address associated with the received virtual address and provide the selected physical address to the memory array 110. For example, if the output of the first comparator 208 indicates that the received virtual address matches the first predetermined address 206, the logic 204 may select a physical address associated with the first predetermined address 206.

In a particular embodiment, a physical address of the memory array 110 may be associated with more than one virtual address. For example, two different software programs running on the CPU 102 may implement different virtual addressing schemes, wherein a particular physical address of the memory array 110 is associated with a different virtual address in each scheme.

In addition, in a particular embodiment, the address space of the virtual memory addresses comparable by the MMU 108 is greater than the physical address space of the memory array 110. For example, the address space of the virtual memory addresses comparable by the MMU 108 may be more than 10 times greater than the physical address space of the memory array 110. Because the comparisons of the received virtual address are taking place in parallel, a large virtual address space may be mapped to a relatively small physical address space quickly.

In the event that a match between the received virtual address and one of the predetermined addresses is found, the logic 204 provides a physical address associated with the received virtual address to the memory array 110. In response, the memory array 110 can perform the appropriate operation at the physical address. For example, in the case of a read operation, the memory array 110 can provide the data stored at the physical address to the memory bus 106 via the returned data bus 224. In the case of a write operation, the memory array 110 can store data at the physical address, and provide an acknowledgement that the data was written via the returned data bus 224.

In contrast, if a match between the received virtual address and one of the predetermined addresses is not found, the logic 204 may assert a fault indication via the fault line 222. This fault indication may be communicated to the CPU 102 or the DMA device 104 via the memory bus 106. In response to the fault indication, the CPU 102 or the DMA device 104 may take a variety of actions. For example, the CPU 102 may provide an error indication to the software program making the memory request associated with the fault. Similarly, the DMA device 104 can provide an error indication to the peripheral device making the memory request. Alternatively, the CPU 102 or the DMA device 104 may alter the virtual memory address associated with the memory request in response to the fault indication.

Referring to FIG. 3, another particular illustrative embodiment of the memory management unit (MMU) 108 of FIG. 1 is illustrated. The MMU 108 of FIG. 3 is similar to the MMU illustrated in FIG. 2, but the logic 204 has been replaced by a multiplexer 302. During operation, the multiplexer 302 is responsive to the outputs of the plurality of comparators, and provides a physical address to the memory array 110 based on the comparator outputs.

The configuration of the comparators 208 through 220 and the multiplexer 302 can result in decreased access times associated with the memory array 108. For example, because the comparators are configured in a parallel arrangement, the proper address may be found more quickly than in other arrangements.

Referring to FIG. 4, a particular illustrative embodiment of a method of translating a virtual address to a physical address is illustrated. This method may be implemented by the MMU 108 illustrated in FIGS. 1, 2, and 3. At block 402, a virtual address is received from a computer device at a memory management unit coupled to the memory device. As explained with respect to FIG. 1, the virtual address may be received from a CPU, a DMA device, or another device. The virtual address may be received in conjunction with a memory request, such as a read request or a write request.

Moving to block 404, at least a portion of the virtual address is concurrently compared to a plurality of different comparators, such as the comparators described with respect to FIG. 2. Each of the plurality of different comparators is associated with a physical address of the memory device.

In a particular embodiment, the entire virtual address is compared to each of the plurality of comparators. As explained with respect to FIG. 1, in another embodiment it may be more efficient for the comparators to compare only a portion of the virtual address. Accordingly, in another particular embodiment, a middle portion of the virtual address is compared to each of the plurality of comparators. This may improve the speed of the address translation process.

Proceeding to block 406, a physical address is determined to access the memory device after performing the concurrent comparison operations. The physical address may be determined based on the output of the comparators, as explained with respect to FIG. 2. In addition, the physical address may be determined by logic, by a multiplexer, by a processor, or other appropriate device.

Moving to decision block 408, it is determined whether a physical address associated with the received virtual address has been found. If a physical address is not found, the method proceeds to block 410 and a fault indication is sent. The fault indication may be sent to the device that sent the virtual address, such as the CPU or DMA device. In addition, the fault signal may be recorded for later analysis or diagnostic treatment.

If a physical address associated with the received virtual address is found at block 408, the method moves to block 412 and the physical address is sent to a memory array. The memory array may act on the memory request based on the physical address. For example the memory array may return data located at the physical address to the requesting device, such as the CPU or DMA device.

In addition, in some virtual memory schemes, a lower portion of a virtual address is identical to a lower portion of an associated physical address. Such schemes may be useful to reduce the complexity of the address translation process. In such schemes, the lower portion of the virtual memory address may be provided to the memory array, and only a middle or upper portion of the virtual address is translated.

The above disclosed subject matter is to be considered illustrative, and not restrictive, and the appended claims are intended to cover all such modifications, enhancements, and other embodiments which fall within the true spirit and scope of the present invention. Thus, to the maximum extent allowed by law, the scope of the present invention is to be determined by the broadest permissible interpretation of the following claims and their equivalents, and shall not be restricted or limited by the foregoing detailed description. 

1. A memory device comprising: a memory array; a memory management unit accessible to the memory array, the memory management unit including: a plurality of parallel comparators to receive and perform a comparison of a virtual memory address to a plurality of predetermined addresses; and logic responsive to outputs of each of the plurality of parallel comparators to determine a physical memory address of the memory array associated with the virtual memory address.
 2. The memory device of claim 1, wherein the logic includes a multiplexer.
 3. The memory device of claim 1, wherein an address space of the virtual memory addresses comparable by the plurality of comparators is greater than the physical address space of the memory array.
 4. The memory device of claim 3, wherein the address space of the virtual memory addresses comparable by the plurality of comparators is more than ten times greater than the physical address space of the memory array.
 5. The memory device of claim 1, wherein the logic sends a fault indication after a received virtual memory address does not correspond to any one of the plurality of predetermined addresses.
 6. The memory device of claim 1, wherein each of the plurality of parallel comparators concurrently compares the virtual memory address to a different predetermined address.
 7. A memory management unit, comprising: a plurality of parallel comparators, each to perform a comparison of a virtual memory address to a predetermined physical address; and logic responsive to outputs of each of the plurality of parallel comparators to determine a physical memory address associated with the virtual memory address.
 8. The memory management unit of claim 7, further comprising: a fault output responsive to the logic, wherein the logic asserts a logic signal at the fault output when a received virtual memory address does not correspond to any of the predetermined physical addresses.
 9. The memory management unit of claim 7, wherein the virtual memory address is received from a direct memory access (DMA) device.
 10. The memory management unit of claim 7, wherein the memory management unit is located at a memory array.
 11. The memory management unit of claim 7, wherein the logic includes a multiplexer.
 12. The memory management unit of claim 7, wherein the virtual memory address is received from a central processing unit (CPU).
 13. A memory, comprising: a plurality of addressable memory locations, wherein each memory location corresponds to a physical address; an input to receive a physical address request corresponding to one of a physical address of one of the plurality of addressable memory locations; an output to provide data to a memory bus; and wherein the physical address request is received from a memory management unit that includes: a plurality of parallel comparators, each to concurrently receive and perform a comparison of a virtual memory address to a predetermined physical address; and logic responsive to outputs of each of the plurality of parallel comparators to determine a physical memory address of an element within the computer memory array.
 14. A method of managing a memory device, the method comprising: receiving a virtual address from a computer device at a memory management unit coupled to the memory device; concurrently comparing at least a portion of the virtual address to a plurality of different comparators, each of the plurality of different comparators associated with a physical address of the memory device; determining a physical address to access the memory device after performing the concurrent comparison; and wherein at least two of the different comparators are associated with a common physical address.
 15. The method of claim 14, wherein the memory management unit is co-located with the memory device.
 16. The method of claim 15, wherein the memory management unit is embedded within the memory device:
 17. The method of claim 14, wherein concurrently comparing at least a portion of the virtual address includes comparing a middle portion of the virtual address.
 18. The method of claim 14, wherein the computer device is a direct memory access (DMA) device.
 19. The method of claim 14, wherein a lower portion of the virtual memory address is identical to a lower portion of a predetermined physical address associated with the virtual memory address. 